package org.an.proj.contacts.config;

import org.an.proj.contacts.BuildConfig;

/**
 * 创建时间：2016年12月19日22:22 <br>
 * 作者：fuchaoyang <br>
 * 描述：环境配置
 */

public class UriConfig {
  /* 自定义环境 */
  public static String sUserMobileUri;
  public static String sUserFolioUri;

  // 当前环境，自定义环境更改该值，然后重新登录即可
  public static int sEnvType = BuildConfig.ENV_TYPE;

  public static final String HTTP_HEAD = "http://";
  public static final String HTTPS_HEAD = "https://";

  // 登录相关
  interface Mobile {

    // 开发环境
    String TEST_SERVER_DOMAIN = "develop.api.link.lianjia.com/mobileapi/";

    // QA测试环境: mobile-uc
    String TEST_QA_SERVER_DOMAIN = "test.api.link.lianjia.com/mobileapi/";
    //String TEST_QA_SERVER_DOMAIN = "test-next.api.link.lianjia.com/mobileapi/";

    // 预线上环境
    String PRELINE_SERVER_DOMAIN = "preline.api.link.lianjia.com/mobileapi/";

    // 线上环境
    String SERVER_DOMAIN = "api.link.lianjia.com/mobileapi/";
  }

  interface Link {

    // 开发环境
    String TEST_SERVER_DOMAIN = "develop.api.link.lianjia.com/folio/";

    // qa测试环境:
    String TEST_QA_SERVER_DOMAIN = "test.api.link.lianjia.com/folio/";
    //String TEST_QA_SERVER_DOMAIN = "test-next.api.link.lianjia.com/folio/";

    // Link预上线环境
    String PRELINE_SERVER_DOMAIN = "preline.api.link.lianjia.com/folio/";

    // 线上环境
    String SERVER_DOMAIN = "api.link.lianjia.com/folio/";
  }

  public static String getMobileUriBase() {
    String baseUri;
    switch (sEnvType) {
      case BuildConfig.EVN_RELEASE:
        baseUri = HTTPS_HEAD + Mobile.SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_USER:
        baseUri = sUserMobileUri;
        break;
      case BuildConfig.EVN_DEV:
        baseUri = HTTP_HEAD + Mobile.TEST_SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_QA:
        baseUri = HTTP_HEAD + Mobile.TEST_QA_SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_PRE:
        baseUri = HTTP_HEAD + Mobile.PRELINE_SERVER_DOMAIN;
        break;
      default:
        baseUri = HTTPS_HEAD + Mobile.SERVER_DOMAIN;
    }
    return baseUri;
  }

  public static String getLinkUriBase() {
    String baseUri;
    switch (sEnvType) {
      case BuildConfig.EVN_RELEASE:
        baseUri = HTTPS_HEAD + Link.SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_USER:
        baseUri = sUserFolioUri;
        break;
      case BuildConfig.EVN_DEV:
        baseUri = HTTP_HEAD + Link.TEST_SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_QA:
        baseUri = HTTP_HEAD + Link.TEST_QA_SERVER_DOMAIN;
        break;
      case BuildConfig.EVN_PRE:
        baseUri = HTTP_HEAD + Link.PRELINE_SERVER_DOMAIN;
        break;
      default:
        baseUri = HTTPS_HEAD + Link.SERVER_DOMAIN;
    }
    return baseUri;
  }

  public static String getGithubUriBase() {
    return "https://api.github.com/repos/jaaksi/API/contents/";
  }
}
